package com.liss.boot.java8.stream;



public class Person implements Comparable<Person>{

  private String name; // 姓名
  private int salary; // 薪资
  private int age; // 年龄
  private String sex; //性别
  private String area; // 地区


  // 构造方法
  public Person(String name, int salary, int age,String sex,String area) {
    this.name = name;
    this.salary = salary;
    this.age = age;
    this.sex = sex;
    this.area = area;
  }
  // 省略了get和set，请自行添加


  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getSalary() {
    return salary;
  }

  public void setSalary(int salary) {
    this.salary = salary;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public String getSex() {
    return sex;
  }

  public void setSex(String sex) {
    this.sex = sex;
  }

  public String getArea() {
    return area;
  }

  public void setArea(String area) {
    this.area = area;
  }

  @Override
  public String toString() {
    return "Person{" +
            "name='" + name + '\'' +
            ", salary=" + salary +
            ", age=" + age +
            ", sex='" + sex + '\'' +
            ", area='" + area + '\'' +
            '}';
  }

  @Override
  public int compareTo(Person o) {
    return String.valueOf(salary).compareTo(String.valueOf(o.getSalary()));
  }
}